﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace _03_Label_TextBox
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        /// <summary>
        /// 消息提示-1
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button1_Click(object sender, EventArgs e)
        {
            MessageBox.Show(this.textBox1.Text);
        }
        /// <summary>
        /// 消息提示-1
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button2_Click(object sender, EventArgs e)
        {
            MessageBox.Show(this.textBox1.Text,"温馨提示");
        }
        /// <summary>
        /// 消息提示-2
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button3_Click(object sender, EventArgs e)
        {
            MessageBox.Show(this.textBox1.Text, "温馨提示",MessageBoxButtons.OKCancel);
        }
        /// <summary>
        /// 消息提示-3
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button4_Click(object sender, EventArgs e)
        {
            DialogResult dialogResult = MessageBox.Show(this.textBox1.Text, "温馨提示", MessageBoxButtons.OKCancel,MessageBoxIcon.Information);
            Console.WriteLine(dialogResult);
        }
        /// <summary>
        /// 显示/隐藏密码
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button5_Click(object sender, EventArgs e)
        {
            if (this.button2.Text == "显示密码")
            {
                this.button2.Text = "隐藏密码";
                this.textBox1.PasswordChar = '\0';//取消密码字符
            }
            else
            {
                this.button2.Text = "显示密码";
                this.textBox1.PasswordChar = '*';//设置密码字符
            }
        }

        private void button6_Click(object sender, EventArgs e)
        {
            //使用for循环添加日志
            for (int i = 0; i < 25; i++)
            {
                this.textBox3.AppendText("这是第" + i + "条日志"+Environment.NewLine);
            }
        }
    }
}
